﻿<UserControl x:Class="OSChina.Controls.PostsListControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
             xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:tileEffect="clr-namespace:WP7_ControlsLib.Controls;assembly=WP7_ControlsLib"
    tileEffect:TiltEffect.IsTiltEnabled="True"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">

    <UserControl.Resources>
        <DataTemplate x:Key="template_Normal">
            <Grid Margin="0,16,0,20">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="70" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <!-- 头像 -->
                <Image Name="img" Width="50" Height="50" Margin="0,27,0,0" Source="{Binding portrait,Mode=OneTime}" VerticalAlignment="Top" MouseLeftButtonUp="img_MouseLeftButtonDown" />
                <StackPanel Grid.Column="1" Margin="5,22,0,0"  VerticalAlignment="Top">
                    <TextBlock Style="{StaticResource style_DefaultText}" Text="{Binding title,Mode=OneTime}" FontSize="25" TextWrapping="Wrap"  Width="340" />
                    <TextBlock Style="{StaticResource style_BodyText}" Text="{Binding outline,Mode=OneTime}" Foreground="Gray" Margin="0,5,0,0" />
                </StackPanel>
                <Grid Width="38" Height="21" Margin="14,28,0,0" Background="{StaticResource PhoneAccentBrush}" Grid.Column="2" VerticalAlignment="Top">
                    <TextBlock Text="{Binding answerCount,Mode=OneTime}" FontSize="17" Foreground="Black" HorizontalAlignment="Center" VerticalAlignment="Center" />
                </Grid>
            </Grid>
        </DataTemplate>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot">
        <ListBox Name="list_Posts" ItemTemplate="{StaticResource template_Normal}" SelectionChanged="list_Posts_SelectionChanged">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <VirtualizingStackPanel CacheMode="BitmapCache"/>
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
        </ListBox>
    </Grid>
</UserControl>
